import {message, Modal} from "antd";
import {makeAutoObservable} from "mobx";
import _ from "lodash";
import {apiLogout} from "@/common/apis/user";

class LoginStore {
  constructor() {
    makeAutoObservable(this)
  }

  loading = false;

  logout(hideMessage = false) {
    apiLogout();
    if (!hideMessage) {
      message.info("您的登录信息已经失效，将会跳转到登录页面...");
      setTimeout(() => {
        // 解决 safari 白屏问题
        document.location.href = "/login";
      }, 1000);
    } else {
      document.location.href = "/login";
    }
    // clearAllStore();
  }
}

export default new LoginStore()
